package com.bing.img.service.impl;

import com.bing.img.dao.ImgDao;
import com.bing.img.model.Img;
import com.bing.img.service.IImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * Created by Zhou Bing
 * <p>
 * 2017/11/15.
 */
@Service
public class ImgServiceImpl implements IImgService{


    @Autowired
    ImgDao imgDao;

    public String findImgById(String id) {

        return imgDao.findBaseValueById(id);
    }

    public Img saveImg(String base64) {


        Img img = new Img(UUID.randomUUID().toString(),base64);

        imgDao.saveImg(img);

        return img;
    }
}
